fix(render): strip undeclared inputs in NgComponentOutlet (NG0303 silence)#368
Merged
Conversation
RenderElement passes 5 framework-only inputs to every mounted component (bindings, emit, loading, childKeys, spec), plus any user-defined props from the spec. Angular dev mode raises NG0303 for any key the target component doesn't declare — measured ~100 errors per dashboard turn: ~25 from the brief skeleton phase (DefaultFallbackComponent declares zero inputs and rejects all of them) and ~75 from user view components that don't declare the framework keys. Filter via reflectComponentType() before passing to ngComponentOutlet: - Reflection succeeded → pass only the keys the component declares - Reflection failed (uncompiled / non-component) → pass-through The distinction between "0 declared inputs" (filter all) and "no metadata available" (pass-through) is important — naive `.size === 0` treats DefaultFallbackComponent as no-metadata and keeps the spam. Verified via chrome MCP: 0 NG0303 errors per dashboard turn (was ~100), all 4 stat cards / 2 charts / 1 grid still render correctly. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RenderElementpasses 5 framework-only inputs to every component it mounts (bindings,emit,loading,childKeys,spec) plus user-defined props from the spec. Angular dev mode raises NG0303 for every key the target component doesn't declare. Live measurement on the chat-generative-ui dashboard: ~100 errors per turn.Breakdown of the 100 errors per dashboard turn:
DefaultFallbackComponentdeclares zero inputs and rejects all of themDashboardGrid,Container,StatCard,LineChart,BarChart,DataGrid) that don't declare the 5 framework keysFix
Filter
resolvedInputsviareflectComponentType()before passing tongComponentOutlet. Cache the declared-input set per component class via aWeakMap.The key correctness call: distinguish "0 declared inputs" (filter all keys) from "no metadata available" (pass-through). The naive check
if (declared.size === 0) return inputstreatsDefaultFallbackComponentas no-metadata and keeps spamming. The fix storesnullvsSetin the cache and only short-circuits onnull.Test plan
pnpm nx run cockpit-chat-generative-ui-angular:build— cleanLibrary — lint / test / buildFiles
libs/render/src/lib/render-element.component.ts— addgetDeclaredInputs()+filterInputsForClass()helpers, wire into both non-repeat and repeat input paths🤖 Generated with Claude Code